package test;
import java.util.Date;
import java.util.Random;


public class ZhongWen {
	
	public static void main(String[] args) throws Exception {
		String str = new ZhongWen().getChinese();
		System.out.println(str);
	}

	/**
	 * 随即中文
	 * @param seed
	 * @return
	 * @throws Exception
	 */
	public String getChinese() throws Exception{   
        String str=null;   
        int highPos,lowPos;   
        long seed=new Date().getTime();   
        Random random=new Random(seed);   
        highPos=(176+Math.abs(random.nextInt(39)));   
        lowPos=161+Math.abs(random.nextInt(93));   

        byte[] b=new byte[2];   
        b[0]=(new Integer(highPos)).byteValue();   
        b[1]=(new Integer(lowPos)).byteValue();   
        str=new String(b,"GB2312");   
        return str;   
	}
	
	public String getChinese(int n) throws Exception {
		StringBuffer sb = new StringBuffer();
		for(int i=0; i<n; i++) {
			sb.append(this.getChinese());
		}
		return sb.toString();
	}
}
